package www.wen.com.common.lib.data.network


import www.wen.com.common.R
import www.wen.com.common.lib.data.entities.builtIn.RequestBodyParameter
import www.wen.com.common.lib.data.entities.builtIn.Result
import www.wen.com.common.lib.data.entities.nonIntrinsic.RecordEntity
import www.wen.com.common.lib.di.api.executeResponse
import www.wen.com.common.lib.di.api.safeApiCall
import www.wen.com.common.lib.extension.getString
import javax.inject.Inject
import javax.inject.Singleton

/**
 * @author WEN
 * @Description: 具体参数请参考ApiService的接口说明
 * @date 2020/11/25 11:13
 */
@Singleton
class ApiHelperImpl @Inject constructor(private val apiService: ApiService) : ApiHelper {

    override suspend fun requestSignBasket(bodyParameter: RequestBodyParameter): Result<RecordEntity> {
        return safeApiCall(
            call = { executeResponse(apiService.requestSignBasket(bodyParameter)) },
            errorMessage = getString(R.string.networkAnomaly)
        )
    }

}
